home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / crwdemo / gsort.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-12-05  |  7.1 KB  |  244 lines

  1. VERSION 2.00
  2. Begin Form GSort 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Group Sort Fields"
  5.    ClientHeight    =   5385
  6.    ClientLeft      =   1680
  7.    ClientTop       =   2010
  8.    ClientWidth     =   6720
  9.    Height          =   6075
  10.    Left            =   1620
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   5385
  13.    ScaleWidth      =   6720
  14.    Top             =   1380
  15.    Width           =   6840
  16.    Begin CommandButton Command8 
  17.       Caption         =   "Help"
  18.       Height          =   420
  19.       Left            =   2610
  20.       TabIndex        =   15
  21.       Top             =   3870
  22.       Width           =   2085
  23.    End
  24.    Begin CommandButton Command6 
  25.       Caption         =   "Ok"
  26.       Height          =   420
  27.       Left            =   360
  28.       TabIndex        =   14
  29.       Top             =   3870
  30.       Width           =   2085
  31.    End
  32.    Begin TextBox Text3 
  33.       Height          =   1050
  34.       Left            =   360
  35.       TabIndex        =   11
  36.       Top             =   2025
  37.       Width           =   6045
  38.    End
  39.    Begin TextBox Text2 
  40.       Enabled         =   0   'False
  41.       Height          =   420
  42.       Left            =   2610
  43.       TabIndex        =   10
  44.       Top             =   630
  45.       Width           =   1005
  46.    End
  47.    Begin TextBox Text1 
  48.       Height          =   375
  49.       Left            =   2610
  50.       TabIndex        =   9
  51.       Top             =   1530
  52.       Width           =   1005
  53.    End
  54.    Begin SSPanel Panel3D2 
  55.       Alignment       =   1  'Left Justify - MIDDLE
  56.       BevelInner      =   1  'Inset
  57.       BorderWidth     =   1
  58.       Height          =   1050
  59.       Left            =   4860
  60.       TabIndex        =   6
  61.       Top             =   3240
  62.       Width           =   1545
  63.       Begin SSOption Option3D1 
  64.          Caption         =   "Descending"
  65.          Height          =   330
  66.          Index           =   1
  67.          Left            =   90
  68.          TabIndex        =   8
  69.          Top             =   585
  70.          Width           =   1275
  71.       End
  72.       Begin SSOption Option3D1 
  73.          Caption         =   "Ascending"
  74.          Height          =   330
  75.          Index           =   0
  76.          Left            =   90
  77.          TabIndex        =   7
  78.          Top             =   135
  79.          Width           =   1275
  80.       End
  81.    End
  82.    Begin CommandButton Command5 
  83.       Caption         =   "Set Group Sort Field"
  84.       Height          =   420
  85.       Left            =   2610
  86.       TabIndex        =   5
  87.       Top             =   3240
  88.       Width           =   2085
  89.    End
  90.    Begin CommandButton Command4 
  91.       Caption         =   "Get Group Sort Field"
  92.       Height          =   420
  93.       Left            =   360
  94.       TabIndex        =   4
  95.       Top             =   3240
  96.       Width           =   2085
  97.    End
  98.    Begin CommandButton Command3 
  99.       Caption         =   "# Group Sort Fields"
  100.       Height          =   420
  101.       Left            =   360
  102.       TabIndex        =   3
  103.       Top             =   630
  104.       Width           =   1905
  105.    End
  106.    Begin CommandButton Command2 
  107.       Caption         =   ">>"
  108.       Height          =   420
  109.       Left            =   1440
  110.       TabIndex        =   2
  111.       Top             =   1485
  112.       Width           =   915
  113.    End
  114.    Begin CommandButton Command1 
  115.       Caption         =   "<<"
  116.       Height          =   420
  117.       Left            =   360
  118.       TabIndex        =   1
  119.       Top             =   1485
  120.       Width           =   915
  121.    End
  122.    Begin SSPanel StatusBar 
  123.       Alignment       =   1  'Left Justify - MIDDLE
  124.       BorderWidth     =   1
  125.       Height          =   510
  126.       Left            =   0
  127.       TabIndex        =   0
  128.       Top             =   4905
  129.       Width           =   7395
  130.    End
  131.    Begin Label Label2 
  132.       BackColor       =   &H00C0C0C0&
  133.       Caption         =   "Group Sort Field Number"
  134.       Height          =   240
  135.       Left            =   2610
  136.       TabIndex        =   13
  137.       Top             =   1170
  138.       Width           =   2175
  139.    End
  140.    Begin Label Label1 
  141.       BackColor       =   &H00C0C0C0&
  142.       Caption         =   "# of Group Sort Fields"
  143.       Height          =   240
  144.       Left            =   2610
  145.       TabIndex        =   12
  146.       Top             =   270
  147.       Width           =   2175
  148.    End
  149.    Begin Menu MenuFile 
  150.       Caption         =   "&File"
  151.       Begin Menu MenuExit 
  152.          Caption         =   "&Exit"
  153.       End
  154.    End
  155. Dim NumFields As Integer
  156. Sub Command1_Click ()
  157.    Dim nSort As Integer
  158.    If (SortN > 0) Then
  159.       SortN = SortN - 1
  160.       Text1.Text = SortN
  161.    End If
  162. End Sub
  163. Sub Command2_Click ()
  164.   Dim nSorts As Integer
  165.   nSorts = PEGetNGroupSortFields(JobNum)
  166.   If nSorts = 0 Then
  167.      Text1.Text = 0
  168.    Else
  169.      If (SortN < nSorts - 1) Then
  170.         SortN = SortN + 1
  171.         Text1.Text = SortN
  172.      End If
  173.    End If
  174. End Sub
  175. Sub Command3_Click ()
  176.  NumFields = PEGetNGroupSortFields(JobNum)
  177.  If NumFields >= 0 Then
  178.    GSort!StatusBar.Caption = "# of Sort fields Retrieved"
  179.    Text1.Text = 0
  180.    Text2.Text = NumFields
  181.    Else
  182.       RCode = GetErrorString(JobNum)
  183.       MsgBox "PEGetNGroupSortFields Error #: " + Str(ErrorCode) + " - " + RCode
  184.  End If
  185. End Sub
  186. Sub Command4_Click ()
  187.   Dim TextHandle As Integer, TextLength As Integer
  188.   Dim FieldName As String
  189.   If NumFields = 0 Then
  190.    MsgBox ("There are no sort fields to retrieve.")
  191.   Else
  192.    If PEGetNthGroupSortField(JobNum, Text1.Text, TextHandle, TextLength, d%) = False Then
  193.       RCode = GetErrorString(JobNum)
  194.       MsgBox "PEGetNthGroupSortField Error #: " + Str(ErrorCode) + " - " + RCode
  195.     End If
  196.     ' Allocate memory for FieldName
  197.     FieldName = String$(TextLength, " ")
  198.     If PEGetHandleString(TextHandle, FieldName, TextLength) = False Then
  199.       RCode = GetErrorString(JobNum)
  200.       MsgBox "PEGetHandleString Error #: " + Str(ErrorCode) + " - " + RCode
  201.     Else
  202.       GSort!StatusBar.Caption = "Group Sort field number " + Text1.Text + " has been retrieved"
  203.       Text3.Text = FieldName
  204.     End If
  205.     If d% = 0 Then
  206.       Option3d1(1).Value = True
  207.       Option3d1(0).Value = False
  208.     Else
  209.       Option3d1(0).Value = True
  210.       Option3d1(1).Value = False
  211.     End If
  212.   End If
  213. End Sub
  214. Sub Command5_Click ()
  215.   If Text3.Text = "" Then
  216.     MsgBox "You must enter a field name to set the sort direction!"
  217.   Else
  218.     ' Now Set the sort field with new direction
  219.     If Option3d1(0) = True Then
  220.       d% = 1
  221.     Else
  222.       d% = 0
  223.     End If
  224.     If PESetNthGroupSortField(JobNum, Text1.Text, Text3.Text, d%) = False Then
  225.       RCode = GetErrorString(JobNum)
  226.       MsgBox "PESetNthSortField Error #: " + Str(ErrorCode) + " - " + RCode
  227.     Else
  228.       GSort!StatusBar.Caption = "Group Sort field number " + Text1.Text + " has been set."
  229.     End If
  230.   End If
  231. End Sub
  232. Sub Command6_Click ()
  233.  Unload Me
  234. End Sub
  235. Sub Command8_Click ()
  236.  RCode = Shell("Winhelp c:\crw\crw.hlp", 3)
  237.  If RCode = False Then
  238.    MsgBox ("CRWDEMO cannot find the Crystal Help file in C:\CRW directory")
  239.  End If
  240. End Sub
  241. Sub MenuExit_Click ()
  242.  Unload Me
  243. End Sub
  244.